%%%-------------------------------------------------------------------
%%% @author kk
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 19. 7月 2024 17:39
%%%-------------------------------------------------------------------
-module(d14).
-author("kk").

%% API   对数字列表或者元组中所有的奇数进行求和
-export([filter/2]).

filter(List, odd) ->
  Odd = [H || H <- List, H rem 2 /= 0 ],
  getSum(Odd).
getSum(List) -> getSum(List, 1).
getSum([H | List], Index) ->
  H + getSum(List, Index + 1);
getSum([], Index) -> 0.  % 末尾 0


